﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//#JMJ Create_20240527

namespace IHateWorking.Model
{
    public class Music : INotifyPropertyChanged
    {
        /// <summary>
        /// 歌曲
        /// </summary>
        /// <param name="singer">演唱者</param>
        /// <param name="iD">ID</param>
        public Music(string singer, int iD = 0)
        {
            _singer = singer;
            if (iD > 0)
            { _iD = iD; }

            _url_Dic.Add("Local", "Local");
        }

        #region 变量的通知机制
        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
        { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
        #endregion 以上：变量的通知机制

        private int _iD = 0;
        /// <summary>
        /// ID
        /// </summary>
        public int ID
        {
            get => _iD;
            set
            {
                if (_iD != value)
                {
                    _iD = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _singer = "佚名";
        /// <summary>
        /// 演唱者
        /// </summary>
        public string Singer
        {
            get => _singer;
            set
            {
                if (_singer != value)
                {
                    _singer = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _publish = "";
        /// <summary>
        /// 是否发布
        /// </summary>
        public string Publish
        {
            get => _publish;
            set
            {
                if (_publish != value)
                {
                    _publish = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _name = "佚名 - 未命名";
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get => _name;
            set
            {
                if (_name != value)
                {
                    _name = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _title = "未命名";
        /// <summary>
        /// 标题
        /// </summary>
        public string Title
        {
            get => _title;
            set
            {
                if (_title != value)
                {
                    _title = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _lyricist = "佚名";
        /// <summary>
        /// 词作者
        /// </summary>
        public string Lyricist
        {
            get => _lyricist;
            set
            {
                if (_lyricist != value)
                {
                    _lyricist = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _composer = "佚名";
        /// <summary>
        /// 词作者
        /// </summary>
        public string Composer
        {
            get => _composer;
            set
            {
                if (_composer != value)
                {
                    _composer = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _key = "";
        /// <summary>
        /// 调
        /// </summary>
        public string Key
        {
            get => _key;
            set
            {
                if (_key != value)
                {
                    _key = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _beat = "";
        /// <summary>
        /// 拍号
        /// </summary>
        public string Beat
        {
            get => _beat;
            set
            {
                if (_beat != value)
                {
                    _beat = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _speed = "";
        /// <summary>
        /// 速度
        /// </summary>
        public string Speed
        {
            get => _speed;
            set
            {
                if (_speed != value)
                {
                    _speed = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _album = "";
        /// <summary>
        /// 专辑
        /// </summary>
        public string Album
        {
            get => _album;
            set
            {
                if (_album != value)
                {
                    _album = value;
                    OnPropertyChanged();
                }
            }
        }

        private List<IntrLine> _intr_Album = new List<IntrLine> { new IntrLine("Null")};
        /// <summary>
        /// 专辑介绍
        /// </summary>
        public List<IntrLine> Intr_Album
        {
            get => _intr_Album;
            set
            {
                if (_intr_Album != value)
                {
                    _intr_Album = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _albumTag = "";
        /// <summary>
        /// 专辑 Tag
        /// </summary>
        public string AlbumTag
        {
            get => _albumTag;
            set
            {
                if (_albumTag != value)
                {
                    _albumTag = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _notes = "";
        /// <summary>
        /// 备注
        /// </summary>
        public string Notes
        {
            get => _notes;
            set
            {
                if (_notes != value)
                {
                    _notes = value;
                    OnPropertyChanged();
                }
            }
        }

        private List<IntrLine> _introduction = new List<IntrLine> { new IntrLine("Null") };
        /// <summary>
        /// 介绍
        /// </summary>
        public List<IntrLine> Introduction
        {
            get => _introduction;
            set
            {
                if (_introduction != value)
                {
                    _introduction = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _lyricPath = "";
        /// <summary>
        /// 歌词文件地址
        /// </summary>
        public string LyricPath
        {
            get => _lyricPath;
            set
            {
                if (_lyricPath != value)
                {
                    _lyricPath = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _scorePath = "";
        /// <summary>
        /// 乐谱文件地址
        /// </summary>
        public string ScorePath
        {
            get => _scorePath;
            set
            {
                if (_scorePath != value)
                {
                    _scorePath = value;
                    OnPropertyChanged();
                }
            }
        }

        private Dictionary<string, string> _url_Dic = new Dictionary<string, string>();
        /// <summary>
        /// Url 字典
        /// </summary>
        public Dictionary<string, string> Url_Dic
        {
            get => _url_Dic;
            set
            {
                if (_url_Dic != value)
                { _url_Dic = value; }
            }
        }

        private string _currentUrl  = "Local";
        /// <summary>
        /// 当前平台的 Url 链接
        /// </summary>
        public string CurrentUrl
        {
            get => _currentUrl;
            set
            {
                if (_currentUrl != value)
                {
                    _currentUrl = value;
                    OnPropertyChanged();
                }
            }
        }
    }

    /// <summary>
    /// 信息类型
    /// </summary>
    public enum InfoType
    {
        歌曲,
        专辑,
        参与者,
    }
}
